﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;

namespace DemoServerBusinessLogic
{
    public class Server : MarshalByRefObject, DemoIServerBusinessLogic.IServer
    {
        
        #region IServer Members

        public System.Data.DataSet getNameList(string strPosition)
        {
            int nPosition = -1;
            if (strPosition == "Engineering")
            {
                nPosition = 1;
            }
            else if (strPosition == "Manager")
            {
                nPosition = 2;
            }
            Database db = DatabaseFactory.CreateDatabase();
            string sqlCommand = "Select name from Employee where JobID = " + nPosition;
            DbCommand dbCmd = db.GetSqlStringCommand(sqlCommand);
            DataSet ds = db.ExecuteDataSet(dbCmd);
            return ds;
        }

        #endregion
    }
}
